package cn.gson.crm.model.dao;

import java.sql.SQLException;
import java.util.Map;

public class TotalDao {
	/**
	 * 获得咨询师分配学生未入学的人数
	 * @param counselorId
	 * @return
	 * @throws SQLException
	 */
	public Integer getEmpAllocationTotal1(Integer counselorId) throws SQLException{
		String sql = "select count(*)total from student where counselor_id = ? and grade_id < 5";
		Map<String, Object> row = Jdbc.getInstace().executeQuery(sql, counselorId);
		Integer count = 0;
		if (row != null) {
			count = Integer.parseInt(row.get("total").toString());
		}
		return count;
	}
	
	/**
	 * 获得咨询师分配学生已入学的人数
	 * @param counselorId
	 * @return
	 * @throws SQLException
	 */
	public Integer getEmpAllocationTotal2(Integer counselorId) throws SQLException{
		String sql = "select count(*)total from student where counselor_id = ? and grade_id > 5";
		Map<String, Object> row = Jdbc.getInstace().executeQuery(sql, counselorId);
		Integer count = 0;
		if (row != null) {
			count = Integer.parseInt(row.get("total").toString());
		}
		return count;
	}
	
}
